<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>  
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<base href="<%=basePath%>" />
<link href="css/layout.css" rel="stylesheet" type="text/css" />
<link href="css/color.css" rel="stylesheet" type="text/css" />
<title>Topic</title>
</head>
<body>
<h2>Hello,${empty sessionScope.user ? 'Anonymous' : sessionScope.user.nickName}</h2>
	<c:if test="${empty sessionScope.user}">
		<p><a href="login.jsp">Sign In</a></p>
	</c:if>
<dl class="list l">
<c:forEach var="t" items="${posts}" varStatus="status">
	<dd <c:if test="${status.index % 2 != 0}">class="odd"</c:if>>
		${status.index + 1} ${t.user.nickName}: ${t.text}
	</dd>
</c:forEach>
</dl>

<form name="newpost" action="newpost">
	<dl class="list l">
		<dt>My Comments:</dt>
		<dd>
			<input type="hidden" name="id" value="${param.id}" />
			<textarea name="text" class="commentArea"></textarea>
		</dd>
		<dd></dd>
		<dd><input type="submit" value="POST"/></dd>
	</dl>
</form>
</body>
</html>